]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
MessageTray: simplify image handling
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 19 Jan 2013 17:49:55 +0000 (18:49 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 19 Jan 2013 18:41:23 +0000 (19:41 +0100)
Remove duplicate checks before calling unsetImage, and set properties
directly in the constructor.

https://bugzilla.gnome.org/show_bug.cgi?id=692091

js/ui/messageTray.js

index bc9bb78f0a74902ab7685acc1262c57d31a1415e..d33b80c4541ab6d310d6d38a6f25c36bb7d6bf85 100644 (file)
@@ -429,7 +429,7 @@ const Notification = new Lang.Class({
             this._actionArea = null;
             this._buttonBox = null;
         }
-        if (this._imageBin && params.clear)
+        if (params.clear)
             this.unsetImage();
 
         if (!this._scrollArea && !this._actionArea && !this._imageBin)
@@ -609,13 +609,14 @@ const Notification = new Lang.Class({
     },
 
     setImage: function(image) {
-        if (this._imageBin)
-            this.unsetImage();
+        this.unsetImage();
+
         if (!image)
             return;
-        this._imageBin = new St.Bin();
-        this._imageBin.child = image;
-        this._imageBin.opacity = 230;
+
+        this._imageBin = new St.Bin({ opacity: 230,
+                                      child: image });
+
         this._table.add_style_class_name('multi-line-notification');
         this._table.add_style_class_name('notification-with-image');
         this._addBannerBody();